"""photo_upload URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, re_path
from app01 import views
from django.conf import settings  ##新增
from django.views.static import serve

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', views.index1),  # 正常上传到 static目录
    path('upload_image_by_paste/', views.upload_image_by_paste),
    path('delete_photo/', views.delete_photo),

    path('up_sql/', views.index2),  # 上传到 media
    path('upload_image_by_media/', views.upload_image_by_media),
    re_path(r'^delete_photo_pro/(?P<nid>\d+)/', views.delete_photo_pro),

    path('up_drag_drop/', views.up_drag_drop),  # 拖拽上传
    path('element_upload/', views.element_upload),

    path('paste_url/', views.paste_url),
    path('upload_photo_paste/', views.upload_photo_paste),

    # media配置
    re_path(r'media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}),
]
